home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / rTutors / part2 / rTutor.rez < prev    next >
Encoding:
Text File  |  1990-06-19  |  8.1 KB  |  347 lines  |  [TEXT/pdos]

  1. /* File: Rtutor.Rez */
  2. /* Rez source file for C version of resource tutorial */
  3. /* Part 1:  starting up & shutting down the tools using a resource */
  4. /* Part 2:  do Part 1 and insert a menubar with menus */
  5.  
  6. /* this gives use access to the "standard" pre-defined resource types */
  7. #include "Types.rez"
  8.  
  9. /*---------------------- Startup Record ---------------------------*/
  10. resource rToolStartup (1)
  11. {
  12.  $C080,       /* set master SCB to mode640 + fFastPortAware + fUseShadowing */
  13.  {
  14.   3,$0300,      /* misc tools */
  15.   4,$0302,      /* quickdraw */
  16.   5,$0302,      /* desk manager */
  17.   6,$0300,      /* eventMgr */
  18. /*  7,$0300,      /* scheduler */ /* not used by apps or DA's */
  19. /*  8,$0301,      /* sound tools */ /* not used by this app */
  20. /*  9,$0300,      /* ADB tools */ /* not used by this app */
  21. /*  10,$0300,      /* SANE */ /* started already by pStart.obj */
  22.   11,$0300,      /* int math */
  23.   14,$0301,      /* Window Manager */
  24.   15,$0301,      /* Menu Manager */
  25.   16,$0300,      /* Control Manager */
  26.   18,$0301,      /* QD Aux */
  27.   19,$0300,      /* print manager */
  28.   20,$0301,      /* LineEdit tool set */
  29.   21,$0302,      /* Dialog Manager */
  30.   22,$0300,      /* Scrap manager */
  31.   23,$0301,      /* standard file */
  32.   27,$0301,      /* Font manager */
  33.   28,$0301,      /* list manager */
  34.   34,$0101,      /* text edit */
  35. /*  29,$0100,      /* ACE */ /* not used by this app */
  36. /*  32,$0100,      /* Midi Tools */ /* not used by this app */
  37. /*  25,$0100,      /* NoteSynth */ /* not used by this app */
  38. /*  26,$0100      /* Note Seq */ /* not used by this app */
  39.  }
  40. };
  41.  
  42.  
  43. /*---------------------- Menus & Menu Bars ---------------------------*/
  44.     /* define the resource id of the menu bar itself */
  45. #define    kMenuBarID1       1
  46.  
  47.     /* define all the menu id's */
  48. #define    kAppleMID   1000
  49. #define    kFileMID    2000
  50. #define    kEditMID    3000
  51.  
  52.     /* now, define the menu item id's */
  53. #define    kAboutBoxIID    1001 /* the "About..." box */
  54.     
  55. #define    kNewItem        2001 /* the "New" item */
  56. #define    kOpenItem       2002 /* the "Open..." item */
  57. #define    kCloseItem       255 /* the "Close" item */
  58. #define    kSaveItem       2004 /* the "Save" item */
  59. #define    kSaveAsItem     2005 /* the "Save As..." item */
  60. #define    kQuitItem       2009 /* the "Quit" item */
  61.       
  62. #define    kUndoItem        250 /* the "Undo" item */
  63. #define    kCutItem         251 /* the "Cut" item */
  64. #define    kCopyItem        252 /* the "Copy" item */
  65. #define    kPasteItem       253 /* the "Paste" item */
  66. #define    kClearItem       254 /* the "Clear" item */
  67. #define    kSelectItem     3001 /* the "Select All" item */
  68.       
  69.     /* now, define the menu bar */
  70. resource rMenuBar (kMenuBarID1)
  71. {
  72.     {
  73.         kAppleMID,
  74.         kFileMID,
  75.         kEditMID,
  76.     };
  77. };
  78.  
  79.  
  80. /* lay out the Apple menu */
  81. /* this takes several steps: */
  82. /* 1)  define the menu itself in a resource of type "rMenu" */
  83. /* 2)  define the rPString that will be used for the name of the menu */
  84. /* 3)  define the first item in the menu in a resource of type "rMenuItem" */
  85. /* 4)  define the rPString that will be used for the name of the first item */
  86. /* 5)  repeat steps 3 and 4 for all remaining items in that menu */
  87. /* 6)  repeat steps 1 through 5 for all remaining menus */
  88.     
  89. resource rMenu (kAppleMID, nocrossbank)
  90. {
  91.     kAppleMID,    /* ID of the menu this item belongs to */
  92.     0xA008, /* flags => menu title is a resource, items are resources, menu */
  93.             /* is enabled, XOR highlighting, std menu, caching ok */
  94.     kAppleMID,    /* ref to menu's title */
  95.     { kAboutBoxIID }; /* array of items in this menu (only 1 to start with) */
  96. };
  97.  
  98. resource rPString (kAppleMID, nocrossbank)
  99. {
  100.     "@"                    /* this string is the title of the "Apple" menu */
  101. };
  102.  
  103. /* see IIGS Toolbox Reference, Volume 3, menu item template */
  104. resource rMenuItem (kAboutBoxIID, nocrossbank)
  105. {
  106.     kAboutBoxIID, /* item's ID */
  107.     "",           /* no keyboard equivalent */
  108.     "",           /* no keyboard equivalent (allowed 2, this is the 2nd) */
  109.     0,            /* this item does not have a check mark by it */
  110.     0x8040,       /* title is in a resource, enabled (bit 7=0), */
  111.                   /* dividing line below (bit 6=1)  */
  112.     kAboutBoxIID  /* ref of the item's title */
  113. };
  114.  
  115. resource rPString (kAboutBoxIID, nocrossbank)
  116. {
  117.     "About rTutor" /* used as the title for the "About..." item */
  118. };
  119.  
  120.  
  121.     /* lay out the File menu */
  122.     
  123. resource rMenu (kFileMID, nocrossbank) /* leave out printing items for now */
  124. {
  125.     kFileMID,  /* ID of the menu this item belongs to */
  126.     0xA008,    /* flags => menu title is a resource, items are resources, */
  127.                /* menu is enabled, don't use XOR highlighting, std menu,  */
  128.                /* caching ok */
  129.     kFileMID,  /* ref to menu's title */
  130.     {          /* array of items in this menu */
  131.         kNewItem,
  132.         kOpenItem,
  133.         kCloseItem,
  134.         kSaveItem,
  135.         kSaveAsItem,
  136.         kQuitItem
  137.     };
  138. };
  139.  
  140. resource rPString (kFileMID, nocrossbank)
  141. {
  142.     " File "   /* this string is the title of the "File" menu */
  143. };
  144.  
  145. resource rMenuItem (kNewItem, nocrossbank)
  146. {
  147.     kNewItem,  /* item's ID */
  148.     "N",       /* keyboard equivalent = "N" */
  149.     "n",       /* or = "n" (either key will work) */
  150.     0,         /* this item does not have a check mark by it */
  151.     0x8000,    /* title is in a resource, enabled (bit 7 = 0)  */
  152.     kNewItem   /* ref of the item's title */
  153. };
  154.  
  155. resource rPString (kNewItem, nocrossbank)
  156. {
  157.     "New"      /* this string is used as the title for the "New" item */
  158. };
  159.  
  160. resource rMenuItem (kOpenItem, nocrossbank)
  161. {
  162.     kOpenItem,
  163.     "O",       /* that's an "OH" on this line, not a "zero" */
  164.     "o",       /* that's an "OH" on this line, not a "zero" */
  165.     0,         /* this one's a "zero" */
  166.     0x8040,    /* the "4" means put a dividing line under this item */
  167.     kOpenItem
  168. };
  169.  
  170. resource rPString (kOpenItem, nocrossbank)
  171. {
  172.     "Open..."
  173. };
  174.  
  175. resource rMenuItem (kCloseItem, nocrossbank)
  176. {
  177.     kCloseItem,
  178.     "W",
  179.     "w",
  180.     0,
  181.     0x8000,
  182.     kCloseItem
  183. };
  184.  
  185. resource rPString (kCloseItem, nocrossbank)
  186. {
  187.     "Close"
  188. };
  189.  
  190. resource rMenuItem (kSaveItem, nocrossbank)
  191. {
  192.     kSaveItem,
  193.     "S",
  194.     "s",
  195.     0,
  196.     0x8000,
  197.     kSaveItem
  198. };
  199.  
  200. resource rPString (kSaveItem, nocrossbank)
  201. {
  202.     "Save"
  203. };
  204.  
  205. resource rMenuItem (kSaveAsItem, nocrossbank)
  206. {
  207.     kSaveAsItem,
  208.     "",        /* no key equivalents for this item */
  209.     "",
  210.     0,
  211.     0x8000,
  212.     kSaveAsItem    
  213. };
  214.  
  215. resource rPString (kSaveAsItem, nocrossbank)
  216. {
  217.     "Save As..."
  218. };
  219.  
  220. resource rMenuItem (kQuitItem, nocrossbank)
  221. {
  222.     kQuitItem,
  223.     "Q",
  224.     "q",
  225.     0,
  226.     0x8000,
  227.     kQuitItem    
  228. };
  229.  
  230. resource rPString (kQuitItem, nocrossbank)
  231. {
  232.     "Quit"
  233. };
  234.  
  235.  
  236.     /* lay out the Edit menu */
  237.     
  238. resource rMenu (kEditMID, nocrossbank)
  239. {
  240.     kEditMID,    /* ID of the menu this item belongs to */
  241.     0xA008,
  242.     kEditMID,    /* ref to menu's title */
  243.     {            /* array of items in this menu */
  244.         kUndoItem,
  245.         kCutItem,
  246.         kCopyItem,
  247.         kPasteItem,
  248.         kClearItem,
  249.         kSelectItem
  250.     };
  251. };
  252.  
  253. resource rPString (kEditMID, nocrossbank)
  254. {
  255.     " Edit "   /* this string is the title of the "Edit" menu */
  256. };
  257.  
  258. resource rMenuItem (kUndoItem, nocrossbank)
  259. {
  260.     kUndoItem,
  261.     "Z",
  262.     "z",
  263.     0,
  264.     0x8040,
  265.     kUndoItem
  266. };
  267.  
  268. resource rPString (kUndoItem, nocrossbank)
  269. {
  270.     "Undo"
  271. };
  272.  
  273. resource rMenuItem (kCutItem, nocrossbank)
  274. {
  275.     kCutItem,
  276.     "X",
  277.     "x",
  278.     0,
  279.     0x8000,
  280.     kCutItem
  281. };
  282.  
  283. resource rPString (kCutItem, nocrossbank)
  284. {
  285.     "Cut"
  286. };
  287.  
  288. resource rMenuItem (kCopyItem, nocrossbank)
  289. {
  290.     kCopyItem,
  291.     "C",
  292.     "c",
  293.     0,
  294.     0x8000,
  295.     kCopyItem
  296. };
  297.  
  298. resource rPString (kCopyItem, nocrossbank)
  299. {
  300.     "Copy"
  301. };
  302.  
  303. resource rMenuItem (kPasteItem, nocrossbank)
  304. {
  305.     kPasteItem,
  306.     "V",
  307.     "v",
  308.     0,
  309.     0x8000,
  310.     kPasteItem
  311. };
  312.  
  313. resource rPString (kPasteItem, nocrossbank)
  314. {
  315.     "Paste"
  316. };
  317.  
  318. resource rMenuItem (kClearItem, nocrossbank)
  319. {
  320.     kClearItem,
  321.     "",
  322.     "",
  323.     0,
  324.     0x8000,
  325.     kClearItem
  326. };
  327.  
  328. resource rPString (kClearItem, nocrossbank)
  329. {
  330.     "Clear"
  331. };
  332.  
  333. resource rMenuItem (kSelectItem, nocrossbank)
  334. {
  335.     kSelectItem,
  336.     "A",
  337.     "a",
  338.     0,
  339.     0x8000,
  340.     kSelectItem
  341. };
  342.  
  343. resource rPString (kSelectItem, nocrossbank)
  344. {
  345.     "Select All"
  346. };
  347.